package com.knowledge.review.designPatterns.creatormode.factorypattern.factorymethodpattern;

import java.util.Objects;
 
/**
 * @author XFW
 * @date 2024/5/6 13:58
 * @Description 抽象工厂角色
 **/
public abstract class FruitAbstractFactory {
 
    public Fruit createFruit(String fruitType) {
        if(Objects.isNull(fruitType)){
            return null;
        }
        if("Apple".equalsIgnoreCase(fruitType)){
            return new Apple();
        } else if("Orange".equalsIgnoreCase(fruitType)) {
            return new Orange();
        }else if("Pear".equalsIgnoreCase(fruitType)){
            return new Pear();
        }
        return null;
    }
 
    public abstract String getFruitColor(Fruit fruit);
 
    public abstract String getFruitTaste(Fruit fruit);
 
}